package com.ta;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @ClassName FixedRatioTactics
 * @Description 固定比例策略,此处设计:传入几，则是多少分之几，传入5则是五分之一
 * @Author xiezhuocai
 * @Date 2023/1/31 19:17
 **/
public class FixedRatioTactics implements Tactics {

    //阀值，传入5，表示五分之一
    private final int clique;
    private final AtomicInteger count = new AtomicInteger(0);

    public FixedRatioTactics(int clique){
        this.clique = clique;
    }


    @Override
    public boolean out() {
        return count.incrementAndGet() % clique == 0 ? true : false;
    }

}
